<%@ page pageEncoding="utf-8" %>
<%@include file="/commons/taglibs.jsp" %>
<!DOCTYPE html>
<html>
<fmt:bundle basename="res">
<head>
    <meta charset="utf-8">
    <title><fmt:message key='zhyyglhtxt'/></title>
    <jsp:include page="/WEB-INF/commons/commons-header.jsp" flush="true"/>
    <style>
        html {
            background: #fff;
        }

        .layui-form-item .layui-input-inline {
            width: 350px;
            line-height: 38px;
        }
    </style>
</head>

<body>
<div class="layui-container">

    <div class="layui-form" lay-filter="layuiadmin-app-form-list" id="layuiadmin-app-form-list" style="padding: 20px 30px 0 0;">

        <div class="layui-form">

            <div class="layui-form-item">
                <label class="layui-form-label"> <fmt:message key='zh'/>：</label>
                <div class="layui-input-inline">${record.user.username}</div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label"> <fmt:message key='ffbh'/>：</label>
                <div class="layui-input-inline">${record.shoppingCard.cardNo}</div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label"> <fmt:message key='gwkmc'/>：</label>
                <div class="layui-input-inline">${record.shoppingCard.name}</div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label"> <fmt:message key='mz'/>：</label>
                <div class="layui-input-inline">${record.shoppingCard.faceValue}</div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label"> <fmt:message key='syje'/>：</label>
                <div class="layui-input-inline">${record.balance}</div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label"> <fmt:message key='yxq'/>：</label>
                <div class="layui-input-inline">
                    <c:if test="${record.shoppingCard.validType == 1}"><fmt:formatDate value="${record.shoppingCard.validStartTime}" pattern="yyyy-MM-dd HH:mm"/> - <fmt:formatDate value="${record.shoppingCard.validEndTime}" pattern="yyyy-MM-dd HH:mm"/></c:if>
                    <c:if test="${record.shoppingCard.validType == 2}"><fmt:message key='gmh'/>${record.shoppingCard.validDays}<fmt:message key='tnksy'/></c:if>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label"> <fmt:message key='sqyy'/>：</label>
                <div class="layui-input-inline">${record.activateApplyNote}</div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label"> <fmt:message key='sqsj'/>：</label>
                <div class="layui-input-inline"><fmt:formatDate value="${record.activateApplyTime}" type="both"/></div>
            </div>


            <%--已审核--%>
            <c:if test="${record.activateStatus != 1}">

                <div class="layui-form-item">
                    <label class="layui-form-label"> <fmt:message key='shjg'/>：</label>
                    <div class="layui-input-inline">
                        <c:if test="${record.activateStatus == 2}"><fmt:message key='shtg'/></c:if>
                        <c:if test="${record.activateStatus == 3}"><fmt:message key='shbtg'/></c:if>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label"> <fmt:message key='jhhyxq'/>：</label>
                    <div class="layui-input-inline">
                        <c:if test="${record.activateStatus == 2}">
                            <fmt:formatDate value="${record.activateStart}" pattern="yyyy.MM.dd HH:mm"/> - <fmt:formatDate value="${record.activateEnd}" pattern="yyyy.MM.dd HH:mm"/>
                        </c:if>
                        <c:if test="${record.activateStatus == 3}">-</c:if>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label"> <fmt:message key='shbz'/>：</label>
                    <div class="layui-input-inline">${record.activateNote}</div>
                </div>
            </c:if>
        </div>

        <%--未审核--%>
        <c:if test="${record.activateStatus == 1}">
            <form action="${web_domain}/mall/marketing/shoppingCard/activate" method="post" id="activate-form">

                <input type="hidden" name="id" value="${record.id}">

                <div class="layui-form-item">
                    <label class="layui-form-label"> <fmt:message key='shjg'/>：</label>
                    <div class="layui-inline">
                        <input type="radio" lay-filter="activateStatus" name="activateStatus" value="2" checked title="<fmt:message key='shtg'/>">
                        <input type="radio" lay-filter="activateStatus" name="activateStatus" value="3" title="<fmt:message key='shbtg'/>">
                    </div>
                </div>

                <div class="layui-form-item" id="activateTime">
                    <label class="layui-form-label"> <fmt:message key='jhyxsj'/>：</label>
                    <div class="layui-input-inline">
                        <input type="text" readonly class="layui-input" name="activateTimeStr" id="activateTimeStr">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label"> <fmt:message key='shbz'/>：</label>
                    <div class="layui-input-inline"><textarea name="activateNote" class="layui-textarea"></textarea></div>
                </div>

                <input type="hidden" id="submit">

            </form>

        </c:if>
    </div>
</div>

<script>
    layui.use(['form', 'laydate'], function () {
        var laydate = layui.laydate;
        var form = layui.form;

        laydate.render({
            elem: "#activateTimeStr",
            type: "date",
            range: true,
            min: Date.now()
        });

        form.on("radio(activateStatus)", function(e) {
            if (e.value === '2') {
                $("#activateTime").show();
            } else {
                $("#activateTime").hide();
            }
        });

        $("#submit").click(function() {
            $("#activate-form").ajaxSubmit({
                success: function (result) {
                    if (result.status) {
                        var index = parent.layer.getFrameIndex(window.name);
                        parent.layer.close(index);
                        parent.$("#search").click();
                    } else {
                        layer.msg(result.message);
                    }
                }
            });
        })
    });
</script>
</body>
</fmt:bundle>
</html>